home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5329 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.os.msdos.programmer,comp.lang.c
  4. Subject: Re: open vs fopen?
  5. Date: 9 Feb 1996 21:26:13 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4fha9lINN7mi@keats.ugrad.cs.ubc.ca>
  8. References: <uEYFxc9nX8WX083yn@mbnet.mb.ca> <4f8bev$6tr@hermes.louisville.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4f8bev$6tr@hermes.louisville.edu>,
  12. George C. Lindauer <gclind01@starbase.spd.louisville.edu> wrote:
  13.  >natewild@mbnet.mb.ca (Nathan T. Wild) writes:
  14.  >
  15.  >>In C, why would one use open and DOS int handles rather than fopen and
  16.  >>stdio file handles?
  17.  >
  18.  >The only reason I know of is UNIX portability.  Whenever I run across a
  19.  >unix program that uses the old-style open instead of fopen I usually
  20.  
  21. There is nothing "old-style" about open(). It is a system call whereas fopen is
  22. a standard C library function. The open() function is typically a  stub which
  23. calls the operating system's open function directly. The fopen() library
  24. routine uses open(), and stores the returned file descriptor inside the FILE
  25. structure.
  26.  
  27.  >end up rewriting it anyway though; I've had so many problems with
  28.  >the unix-style stuff I just rather would deal with the ANSI style.
  29.  
  30. The "ANSI style" still calls the "unix-style" stuff, except everything is
  31. bounced through extra buffers. The standard library functions are for
  32. programmer convenience; that's why UNIX evolved them. But it's not a case of
  33. one replacing the other.
  34. -- 
  35.  
  36.